package com.sw.rpc.consumer;

import com.sw.rpc.service.IUserService;
import com.sw.rpc.service.RpcRequest;
import com.sw.rpc.service.zk.ServiceInstanceService;

/**
 * @author sw
 * @project zdy-rpc
 * @description
 * @date 2020/5/15 13:44
 */
public class ConsumerBootStrap {
    public static  final String providerName="IUserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {
        RpcRequest rpc = new RpcRequest();
        rpc.setMethodName("success");
        ServiceInstanceService.createCuratorZookeeperClient();
        //
       /* RpcConsumerZK rpcConsumer = new RpcConsumerZK();*/
        RpcConsumerZKLoad rpcConsumerZKLoad=new RpcConsumerZKLoad();
        IUserService proxy = (IUserService) rpcConsumerZKLoad.createProxy(IUserService.class);

        while (true) {
            Thread.sleep(2000);
            //System.out.println(proxy.sayHello("are you ok?"));
            System.out.println(proxy.sayHello("hello zk!"));
        }
    }
}
